# Maintainer: Chocobo1

_realname=zopfli
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.0.2
pkgrel=1
arch=('any')
pkgdesc="A compression library programmed in C to perform very good, but slow, deflate or zlib compression (mingw-w64)"
url="https://github.com/google/zopfli"
license=('Apache')
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc")
source=("https://github.com/google/zopfli/archive/${_realname}-${pkgver}.tar.gz")
sha256sums=('4a570307c37172d894ec4ef93b6e8e3aacc401e78cbcc51cf85b212dbc379a55')


build() {
  [[ -d "${srcdir}"/build-${CARCH} ]] && rm -rf "${srcdir}"/build-${CARCH}
  cp -rf ${srcdir}/${_realname}-${_realname}-${pkgver} "${srcdir}"/build-${CARCH}
  cd "${srcdir}"/build-${CARCH}

  make zopfli
  make zopflipng
}

package() {
  cd "${srcdir}"/build-${CARCH}

  mkdir -p "${pkgdir}${MINGW_PREFIX}/bin"
  install -m755 "zopfli" "zopflipng" "${pkgdir}${MINGW_PREFIX}/bin"
  install -Dm644 "COPYING" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING"
}
